<?php


namespace app\adminbackstage\model;


use think\Model;

class AdvertisementPosition extends Model
{
    /*** 广告位置 列表
     * @param $where
     * @param $pageIndex
     * @param $pageSize
     * @return mixed
     */
    public static function advertisementPositionList($where,$pageIndex,$pageSize){
        return self::connect('slave')->where($where)->page($pageIndex,$pageSize)->select();
    }

    /*** 广告位置详情
     * @param $where
     * @return array|Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function advertisementPositionView($where){
        return self::connect('slave')->where($where)->find();
    }

    /*** 广告位置添加
     * @param $data
     * @return advertisement|Model
     */
    public static function advertisementPositionAdd($data){
        return self::create($data);
    }

    /*** 广告位置修改
     * @param $where
     * @param $data
     * @return advertisement
     */
    public static function advertisementPositionEdit($where,$data){
        return self::update($data,$where);
    }

    /*** 统计广告位置总条数
     * @param $where
     * @return int
     */
    public static function advertisementPositionCount($where){
        return self::connect('slave')->where($where)->count();
    }
}